<?php
/**
 * 账单数据管理
 * PHP version 5
 * @package   Antonia
 * @author    Antonia <471699715@qq.com>
 * @copyright 2016 Antonia.
 */
namespace Common\Model;
use Think\Model\RelationModel;
class BillsModel extends RelationModel {

    protected $tableName = 'bills'; 
    
    /**
     * 设置主键
     *
     * @author Antonia
     */
    protected $pk        = 'id';

    /**
     * 自动验证
     *
     * @author Antonia
     */
    protected $_validate = array(
     );

    /**
     * 自动完成
     *
     * @author Antonia
     */
    protected $_auto     = array(

    );

    /**
     * 关联
     * @author Antonia
     */
    protected $_link = array(
        'Orders' => array( 
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Orders',
            'foreign_key'   => 'orderid',
            'mapping_name'  => 'order',
            'mapping_fields'   => 'id,order_sn,payMethod',
        ),
        'Users' => array( 
            'mapping_type'  => self::BELONGS_TO,
            'class_name'    => 'Users',
            'foreign_key'   => 'userid',
            'mapping_name'  => 'user',
            'mapping_fields'   => 'users_id,username',
        )
    );
}
?>